package com.ly.web.controller.erp;

import com.ly.common.annotation.Log;
import com.ly.common.core.domain.AjaxResult;
import com.ly.common.enums.BusinessType;
import com.ly.heart.domain.KingTravelExpensesTypeEntity;
import com.ly.heart.service.IKingTravelExpensesTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 差旅费类型 前端控制器
 * </p>
 * @author WuZH
 * @since 2024-08-18
 */
@Api (value = "KingTravelExpensesType", tags = "差旅费类型")
@RestController
@RequestMapping ("/KingTravelExpensesType")
public class KingTravelExpensesTypeController {

    @Resource
    private IKingTravelExpensesTypeService iKingTravelExpensesTypeService;


    @PreAuthorize ("@ss.hasPermi('heart:KingTravelExpensesType:list')")
    @GetMapping ("/list")
    @ApiOperation ("差旅费类型列表")
    public AjaxResult list (KingTravelExpensesTypeEntity kingTravelExpensesTypeEntity) {
        List<KingTravelExpensesTypeEntity> kingTravelExpensesTypeEntities = iKingTravelExpensesTypeService.queryList ( kingTravelExpensesTypeEntity );
        return AjaxResult.success ();
    }

    @PreAuthorize ("@ss.hasPermi('heart:KingTravelExpensesType:query')")
    @GetMapping (value = "/{id}")
    @ApiOperation ("获取差旅费类型详细信息")
    public AjaxResult getInfo (@PathVariable ("id") String id) {
        return AjaxResult.success ();
    }

    @PreAuthorize ("@ss.hasPermi('heart:KingTravelExpensesType:add')")
    @Log (title = "暂存差旅费类型", businessType = BusinessType.INSERT)
    @PostMapping ("draft")
    @ApiOperation ("暂存差旅费类型")
    public AjaxResult draft (@RequestBody KingTravelExpensesTypeEntity kingTravelExpensesTypeEntity) {
        AjaxResult draft = iKingTravelExpensesTypeService.draft ( kingTravelExpensesTypeEntity );
        return draft;
    }

    @PreAuthorize ("@ss.hasPermi('heart:KingTravelExpensesType:add')")
    @Log (title = "提交差旅费类型", businessType = BusinessType.INSERT)
    @PostMapping ("submit")
    @ApiOperation ("提交差旅费类型")
    public AjaxResult submit (@RequestBody KingTravelExpensesTypeEntity kingTravelExpensesTypeEntity) {
        AjaxResult submit = iKingTravelExpensesTypeService.submit ( kingTravelExpensesTypeEntity );
        return submit;
    }

    @PreAuthorize ("@ss.hasPermi('heart:KingTravelExpensesType:edit')")
    @Log (title = "修改差旅费类型", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation ("修改差旅费类型")
    public AjaxResult updateSingle (@RequestBody KingTravelExpensesTypeEntity kingTravelExpensesTypeEntity) {
        AjaxResult submit = iKingTravelExpensesTypeService.updateSingle ( kingTravelExpensesTypeEntity );
        return submit;
    }

    @PreAuthorize ("@ss.hasPermi('heart:KingTravelExpensesType:remove')")
    @Log (title = "删除差旅费类型", businessType = BusinessType.DELETE)
    @DeleteMapping ("/{ids}")
    @ApiOperation ("删除差旅费类型")
    public AjaxResult deleteSingle (@PathVariable String[] ids) {
        AjaxResult submit = iKingTravelExpensesTypeService.deleteSingle ( ids );
        return submit;
    }

    @PreAuthorize ("@ss.hasPermi('heart:KingTravelExpensesType:remove')")
    @Log (title = "禁用差旅费类型", businessType = BusinessType.INSERT)
    @RequestMapping ("disabled")
    @ApiOperation ("禁用差旅费类型")
    public AjaxResult disabled (String id) {
        AjaxResult submit = iKingTravelExpensesTypeService.disabled ( id );
        return submit;
    }

}
